#include"Factory.h"
MonsterFactory::MonsterFactory(){



}

Monster MonsterFactory::getMonster(const string& name, const Point &p){

 if(name=="虾兵"){
    blame1 b1(p);
    return  b1;
 }
 if(name=="蟹将"){
    blame2 b1(p);
    return  b1;
 } if(name=="龙"){
    blame3 b1(p);
    return  b1;
 }
if(name=="史莱姆")
{
    blame4 b1(p);
    return b1;
}
if(name=="青蛙")
{
    blame5 b1(p);
    return b1;
}
if(name=="小恶魔")
{
    blame6 b1(p);
    return b1;
}
if(name=="小恐龙")
{
    blame7 b1(p);
    return b1;
}
if(name=="小boss")
{
    blame8 b1(p);
    return b1;
}
if(name=="大boss")
{
    blame9 b1(p);
    return b1;
}
blame1 b1(p);
return  b1;
}


shared_ptr<Weapon> WeaponFactory::getWeapon(const string& name) {
    if (name == "剑") {
        return std::make_shared<Weapon>("剑", 10, 10, 0, 0, "武器");
    }
    if (name == "刀") {
        return std::make_shared<Weapon>("刀", 20, 20, 0.2, 0, "武器");
    }
    if (name == "棍") {
        return std::make_shared<Weapon>("棍", 30, 30, 0.1, 0.1, "武器");
    }
    return nullptr;
}


shared_ptr<Armor> ArmorFactory::getArmor(const string& name) {
    if (name == "布甲") {
        return std::make_shared<Armor>("布甲", 10, 2, 0.2, "防具");
    }
    if (name == "皮甲") {
        return std::make_shared<Armor>("皮甲", 20, 3, 0.1, "防具");
    }
    if (name == "铠甲") {
        return std::make_shared<Armor>("铠甲", 30, 4, 0, "防具");
    }
    return nullptr; 
}


shared_ptr<Potion> PotionFactory::getPotion(const string& name) {
    if (name == "大血瓶") {
        return std::make_shared<Potion>("大血瓶", 20, 20, "药品");
    }
    if (name == "中血瓶") {
        return std::make_shared<Potion>("中血瓶", 10, 10, "药品");
    }
    if (name == "小血瓶") {
        return std::make_shared<Potion>("小血瓶", 5, 5, "药品");
    }
    return nullptr; 
}


shared_ptr<Prop> AllFactory(const string& name) {
    WeaponFactory w;
    ArmorFactory a;
    PotionFactory y;

    auto weapon = w.getWeapon(name);
    if (weapon != nullptr) {
        return weapon;
    }

    auto armor = a.getArmor(name);
    if (armor != nullptr) {
        return armor;
    }

    auto potion = y.getPotion(name);
    if (potion != nullptr) {
        return potion;
    }

    return nullptr; 
}
